'''
Created on 29.01.2011

@author: bstar
'''
from dopplershift.collector.http import REQUEST_METHOD_NONE
class Route:
    
    def __init__(self, url, controller_name, action_name):
        self._url = url
        self._controller_name = controller_name
        self._action_name = action_name
        self._conditions = []
    def __unicode__(self):
        return u'<Route "%s">'%(self._url)
    def getActionName(self):
        return self._action_name
    def getControllerName(self):
        return self._controller_name
    def putCondition(self, conditionObj):
        self._conditions.append(conditionObj)
    def findCondition(self, auth_info, method=REQUEST_METHOD_NONE):
        for el in self._conditions:
            if el.isCondition(auth_info, method):
                return el